<cfsetting enablecfoutputonly="true" />
<!--- 
@title: defaultHtmlHead
@description: Loads specific information into the <head> block of the (x)html page
--->

<!--- allow developers to close custom tag by exiting on end --->
<cfif thistag.ExecutionMode eq "end">
  <cfsetting enablecfoutputonly="false" />
	<cfexit method="exittag" />
</cfif>

<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />

<!--- Make sure this tag in only called once per page request --->
<cfif application.stplugins.jcPodcast.bLoadPluginCssFile is true or application.stplugins.jcPodcast.bLoadJsFile is true>
  <cfparam name="request.count_jcPodcast" default="0" />
  <cfset request.count_jcPodcast = request.count_jcPodcast +1 />
  <cfif request.count_jcPodcast gt 1>
    <cfexit />
  </cfif>
<cfelse>
  <cfexit />
</cfif>

<cfif not thistag.HasEndTag>
  <cfabort showerror="Does not have an end tag..." />
</cfif>

<cfparam name="attributes.bLoadPluginCssFile" default="true" type="boolean" />
<cfparam name="attributes.bLoadJsFile" default="true" type="boolean" />

<cfif thistag.ExecutionMode EQ "Start">
  <cfsavecontent variable="jcPodcastHead">
    <cfif attributes.bLoadPluginCssFile is true>

<!--- Output Stylesheets for HEAD --->
<cfoutput>
  <link rel="stylesheet" type="text/css" media="all" href="#application.stplugins.jcPodcast.url.pluginroot#/css/jcPodcast.css" />
  <!--[if IE]>
    <link rel="stylesheet" type="text/css" media="all" href="#application.stplugins.jcPodcast.url.pluginroot#/css/jcPodcast_ie.css" />
  <![endif]-->
</cfoutput>

    </cfif>
    <cfif attributes.bLoadJsFile is true>
      <cfoutput>  <script type="text/javascript" src="#application.stplugins.jcPodcast.url.pluginroot#/js/swfobject.js"></script>#chr(10)##chr(13)#</cfoutput>
    </cfif>
  </cfsavecontent>
  <cfif len(trim(variables.jcPodcastHead)) gt 0>
    <!--- <cfhtmlhead text="#variables.jcPodcastHead#" /> --->
    <!--- Warning: the htmlhead tag adds a lot of tabbed whitespace.  There's nothing I can do about it (I need the htmlHead tag to overcome caching issues using the objectBroker) --->
    <skin:htmlHead id="jcPodcastHead" text="#variables.jcPodcastHead#" />
    <!--- <skin:htmlHead id="jcPodcastHead" text="#variables.jcPodcastHead#" /> --->   
  </cfif>
</cfif>

<cfsetting enablecfoutputonly="false" />